package com.sport.video.gateway.enums;


import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public enum ResultEnum {
    SUCCESS(0, "通信成功"),
    ERROR(-1, "通信失败");


    public final Integer code;
    public final String msg;


    ResultEnum(final Integer code, final String msg) {
        this.msg = msg;
        this.code = code;
    }

    public Serializable getMsg() {
        return this.msg;
    }

    public Integer getCode() {
        return this.code;
    }

    static Map<Object, ResultEnum> enumMap = new HashMap<>();
    static {
        for (ResultEnum type : ResultEnum.values()) {
            enumMap.put(type.getCode(), type);
        }
    }

    public static ResultEnum getEnum(Integer code) {
        return enumMap.get(code);
    }
}
